package com.sk.bilibili.handler;

import com.sk.bilibili.bean.interfaces.BannerAble;
import com.sk.bilibili.property.BiliBiliProperty;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author 邵康
 * @date 2021/12/18 16:40
 */
@Component
public class BaseBannerPostValueHandler implements PostValueHandler<BannerAble> {

    @Autowired
    private BiliBiliProperty biliBiliProperty;
    private static final String NO_HANDLE_PREFIX="http";

    @Override
    public void postHandle(BannerAble bannerAble) {
        if(bannerAble.getUrl().startsWith(NO_HANDLE_PREFIX))return;
        bannerAble.setUrl(biliBiliProperty.getBaseUrl()+ bannerAble.getUrl());
    }

}
